package com.atguigu.dga.meta.mapper;

import com.atguigu.dga.meta.bean.TableMetaInfo;
import com.atguigu.dga.meta.bean.TableMetaInfoVO;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.hadoop.yarn.webapp.hamlet2.Hamlet;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 元数据表 Mapper 接口
 * </p>
 *
 * @author liuxu
 * @since 2023-10-09
 */
@Mapper
@DS("dga")
public interface TableMetaInfoMapper extends BaseMapper<TableMetaInfo> {


    @Select("${sql}")
    public List<TableMetaInfoVO> selectTableMetaInfoVoList (String sql);
    @Select("${sql}")
    Integer selectTableMetaInfoVocount(String sql);
    @Select(  "SELECT \n" +
            "ti.*, te.* , ti.id ti_id , te.id te_id\n" +
            "FROM table_meta_info ti JOIN table_meta_info_extra te\n" +
            "ON ti.schema_name = te.schema_name  AND ti.table_name = te.table_name  \n" +
            "WHERE ti.assess_date = #{assessDate} ")
    //查询结果映射到对应对象
    @ResultMap("meta_result_map")
    public List<TableMetaInfo> selectTableMetaInfoList(String assessDate);
}
